﻿@using OpenIdProvider
@model OpenIdProvider.Models.User

@{
    ViewData["Title"] = "Edit Profile - "+ Model.Email;
}

@ViewData.HandleErrorMessage()

<form method="post" action="/user/edit/submit">
    <table class="position-table">
        <tr>
            <td>
                <label for="realname" class="accessibility-hidden">Real Name</label>
                <input type="text" name="realname" id="realname" value="@(ViewData["realname"] ?? Model.RealName)" maxlength="100" />
                <span class="form-help">John Smith (optional)</span>
            </td>
        </tr>
        <tr>
            <td>
                <label for="vanity" class="accessibility-hidden">Vanity OpenID Name</label>
                <input name="vanity" id="vanity" type="text" value="@(ViewData["vanity"] ?? Model.VanityProviderId)" maxlength="40" />
                <span class="form-help">john.smith (optional)</span>
            </td>
        </tr>
    </table>
    <input type="hidden" name="id" value="@(Model.ProviderId)" />
    <input type="hidden" name="fkey" value="@(Current.XSRFToken)" />
    <input type="submit" class="orange" value="Update" />
</form>
<br>
<a href="#" onclick="$('#delegate').attr('style', ''); $(this).remove();">Use your own URL to log in</a>

<div id="delegate" style="visibility:hidden">
    <p>If you want to use your own URL to log in, add the following two tags to the head of the HTML:</p>
    <code>
        &lt;link rel="openid2.provider" href="@(Current.Url("openid/provider"))"&gt;<br>
        &lt;link rel="openid2.local_id" href="@(Model.GetClaimedIdentifier())"&gt;
    </code>
    <p>This is known as OpenID delegation.</p>
</div>